package net.wanho.shiro.matcher;

import net.wanho.util.JwtUtil;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;

/**
 * Author：汤小洋
 * Date：2023-10-16 10:54
 * Description：<描述>
 */
public class JwtMatcher extends SimpleCredentialsMatcher {

    @Override
    public boolean doCredentialsMatch(AuthenticationToken authenticationToken, AuthenticationInfo info) {
        String token = (String) authenticationToken.getCredentials();
        // 判断token是否有效
        return JwtUtil.valid(token);
    }
}
